<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>
	<script type="text/JavaScript">
		function textCounter(field, maxlimit) {
			if (field.value.length > maxlimit) {
				field.value = field.value.substring(0, (maxlimit + 1) - 1);
				field.blur();
				field.focus();
			}
		}
	</script>
	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<ui:define name="title">#{securityBundle.roles}</ui:define>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">
				<ui:define name="content">
					<h:messages/>
					<ui:decorate template="/facelets/template/tableTemplate.xhtml">
						<ui:param name="actionBean" value="#{roleBean}"/>
						<ui:param name="idPrefix" value="role"/>
						<ui:define name="editPanelContext">

							<rich:pickList id="PickList"
										   value="#{roleBean.permissions}"
										   converter="#{roleBean.dicts}"
										   rendered="#{roleBean.resultListFilled}"
										   copyAllControlLabel="add all"
										   removeAllControlLabel="remove all"
										   copyControlLabel="add"
										   removeControlLabel="remove"
										   switchByClick="true">
								<!--<rich:column>-->
								<itdep:entitySelectItems entityType="permission" format="{name}"/>
								<a4j:support event="onlistchanged"/>
								<!--<h:outputText value="#{items.name}"/>-->
								<!--</rich:column>-->
							</rich:pickList>
							<h:outputText value="#{securityBundle.roleName}" styleClass="requiredField"/>
							<h:inputText value="#{roleBean.record.authority}" id="roleAuthority" required="true"
										 style="width:180px" maxlength="100"/>
							<itdep:errorMessage for="roleAuthority"/>
							<h:outputText value="#{dictionaryBundle.description}" styleClass="requiredField"/>
							<h:inputTextarea value="#{roleBean.record.name}" id="roleDescription" required="true"
											 onblur="textCounter(this,100);" onkeyup="textCounter(this,100);"
											 onkeypress="textCounter(this,100);" onfocus="textCounter(this,100);"
											 onkeydown="textCounter(this,100);"/>
							<itdep:errorMessage for="roleDescription"/>
						</ui:define>

						<ui:define name="tableContext">
							<rich:column width="1%">
								<f:facet name="header">
									<h:outputText value="#{dictionaryBundle.id}"/>
								</f:facet>
								<h:outputText value="#{record.id}"/>
							</rich:column>

							<rich:column width="7%">
								<f:facet name="header">
									<h:outputText value="#{securityBundle.role}"/>
								</f:facet>
								<h:outputText value="#{record.authority}"/>
							</rich:column>

							<rich:column width="28%">
								<f:facet name="header">
									<h:outputText value="#{dictionaryBundle.description}"/>
								</f:facet>
								<h:outputText value="#{record.name}"/>
							</rich:column>

							<rich:column width="28%">
								<f:facet name="header">
									<h:outputText value="#{dictionaryBundle.description}"/>
								</f:facet>
								<h:outputText value="#{record.permissions}"/>
							</rich:column>

						</ui:define>
					</ui:decorate>
				</ui:define>
			</ui:decorate>
		</ui:define>
	</ui:decorate>
</f:view>
